package bll

import (
	"context"

	"github.com/LyricTian/gin-admin/v7/internal/app/schema"
)

// Query 查询数据
func (a *Group) GetMyGroup(ctx context.Context, params schema.GroupQueryParam, opts ...schema.GroupQueryOptions) (*schema.GroupQueryResult, error) {
	reasult, err := a.GroupModel.GetMyGroup(ctx, params, opts...)
	if err != nil {
		return nil, err
	}
	if reasult == nil || len(reasult.Data) == 0 {
		params.Type = -3
		return a.GroupModel.Query(ctx, params, opts...)
	}
	return reasult, nil

}
